#include <vector>
#include <algorithm>
#include <set>
#include <iostream>

using namespace std;

// vector<vector<int>>
void subPermutation( vector<int> v, int n )
{
  set<vector<int>> result;
  do
  {
    vector<int> line(v.begin(), v.begin() + n);
    // for ( int i = 0; i < n; ++i )
    // {
    //   line.push_back( v[i] );
    // }
    result.insert( line );
  } while ( next_permutation( v.begin(), v.end() ) );

  for ( vector<int> vec : result )
  {
    for ( int i : vec )
    {
      cout << i << " ";
    }
    cout << endl;
  }
}

int main(int argc, char const *argv[])
{
  vector<int> v{1, 2, 3};
  subPermutation( v, 1 );  
  return 0;
}
